// const path = require('path')
// import path from 'path';
// 要使用 ESM 的 node 可以安装一个 @types/node 类型声明模块即可
// node16版本之后，还提供了如下的引入方式
// import path from 'node:path'
import path from "path";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import Components from "unplugin-vue-components/vite";
import { VantResolver } from "unplugin-vue-components/resolvers";

// https://vitejs.dev/config/
export default defineConfig({
  base: "/mz",

  plugins: [
    vue(),
    Components({
      resolvers: [VantResolver()],
    }),
  ],

  resolve: {
    // 别名配置
    alias: {
      "@": path.join(__dirname, "./src"),
    },
  },

  build: {
    rollupOptions: {
      input: {
        index: path.resolve(__dirname, "./index.html"),
        post: path.resolve(__dirname, "./post.html"),
      },
    },
  },
});
